home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98b.txt / 000119_icon-group-sender _Tue Jun 30 08:00:26 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id IAA28495
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Tue, 30 Jun 1998 08:00:25 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA01984; Tue, 30 Jun 1998 08:00:13 -0700
  7. Message-Id: <35985E94.B8AC0267@ix.netcom.com>
  8. Date: Mon, 29 Jun 1998 23:42:12 -0400
  9. From: Phillip Lee Thomas <teruthom@ix.netcom.com>
  10. Reply-To: thomaspl@acm.org
  11. X-Mailer: Mozilla 4.05 [en] (Win95; U)
  12. Mime-Version: 1.0
  13. To: icon-group@optima.CS.Arizona.EDU
  14. Subject: Re: Retrieving lists from tables
  15. References: <35970078.4332DA12@ix.netcom.com> <3597BA27.532@gte.net>
  16. Content-Type: text/plain; charset=us-ascii
  17. Content-Transfer-Encoding: 7bit
  18. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  19. Status: RO
  20. Content-Length: 645
  21.  
  22. After pondering the solutions sent in, the following appears to involve the
  23. least processing without making the code absolutely undebugable:
  24.  
  25. record ref(L,part1,part2)  # keep list as first element of record
  26. .....
  27.          t := table()
  28.          hashval := hash(L)
  29.          if \t[hashval] then
  30.            t[hashval].part1 +:= 1
  31.          else
  32.            t[hashval] := ref(L,1,1)
  33. ....
  34.  
  35. # later retrieval of the list for further processing can be done through
  36. #    converting the table to a sorted list or whatever is appropriate.
  37.  
  38. procedure hash(L)
  39.     # return some string unique to each list L
  40. end
  41.  
  42. Thanks again to all who responded.
  43.  
  44. Phillip
  45.  
  46.  
  47.